package cn.fresh.xuanyuan.module.infra.controller.app.city;

import cn.fresh.xuanyuan.framework.common.pojo.CommonResult;
import cn.fresh.xuanyuan.module.infra.service.city.CityService;
import cn.fresh.xuanyuan.module.infra.vo.CityTreeVo;
import cn.fresh.xuanyuan.module.infra.vo.CityVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(value = "/infra/city")
@Tag(name = "用户 微信端 - 城市数据")
@Slf4j
public class CityController {

    @Resource
    private CityService cityService;

    @GetMapping(value = "/getCityList")
    public CommonResult<List<CityTreeVo>> getCityList() {
        List<CityTreeVo> tree = cityService.getCityList();
        return CommonResult.success(tree);
    }
}
